package leetcode.editor.cn;

class FactorialTrailingZeroes {
    public static void main(String[] args) {
        Solution solution = new FactorialTrailingZeroes().new Solution();
    }

    //leetcode submit region begin(Prohibit modification and deletion)
    class Solution {
        // https://leetcode.cn/problems/factorial-trailing-zeroes/solution/xiang-xi-tong-su-de-si-lu-fen-xi-by-windliang-3/
        // 求因子为10， 10 = 2 * 5，2的数量大于5，所以相当于求5的个数
        public int trailingZeroes(int n) {
            int ans = 0;
            while (n != 0) {
                n /= 5;
                ans += n;
            }

            return ans;
        }
    }
//leetcode submit region end(Prohibit modification and deletion)

}
